<?php
/**
 * Created by PhpStorm.
 * User: kaycn
 * Date: 18-9-18
 * Time: 上午1:55
 */
namespace Facebook\WebDriver;

use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;

require_once('vendor/autoload.php');

header("Content-Type: text/html; charset=UTF-8");
// start Firefox with 5 second timeout
$waitSeconds = 15;  //需等待加载的时间，一般加载时间在0-15秒，如果超过15秒，报错。
$host = 'http://localhost:4444/wd/hub'; // this is the default
//这里使用的是chrome浏览器进行测试，需到http://www.seleniumhq.org/download/上下载对应的浏览器测试插件
//我这里下载的是win32 Google Chrome Driver 2.25版：https://chromedriver.storage.googleapis.com/index.html?path=2.25/
$capabilities = DesiredCapabilities::chrome();
$driver = RemoteWebDriver::create($host, $capabilities, 5000);

$driver->get('http://172.16.17.117/');

$driver -> findElement(WebDriverBy::id('txtUserName'))->sendKeys("415050509");
$driver -> findElement(WebDriverBy::id('TextBox2'))->sendKeys("19960521Aa");
$driver -> findElement(WebDriverBy::id('txtSecretCode'))->sendKeys('123456');

